package com.leetcode;

public class 回文数 {

    public static void main(String[] args) {
        System.out.println(revertedNumber(10));
    }

    public static boolean revertedNumber(int num) {
        if (num < 0 || (num % 10 == 0 && num > 0)) {
            return false;
        }
        int revertedNumber = 0;
        while (num > revertedNumber) {
            int x = num % 10;
            num = num / 10;
            revertedNumber = revertedNumber * 10 + x;
        }
        return revertedNumber == num || revertedNumber / 10 == num;
    }

}
